﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<!DOCTYPE HTML>
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
		<title>USER CENTER</title>
		<%@ include file="/share/include.jsp" %>
		<!-- <script src="js/jquery.min.js"></script> -->
   		 <meta name="viewport" content="width=device-width, initial-scale=1">
		 <script type="application/x-javascript"> 
			addEventListener("load", function() { 
				setTimeout(hideURLbar, 0); 
			}, false); 
			function hideURLbar(){ 
				window.scrollTo(0,1); 
			} 
		</script>
		<script type="text/javascript">
			//用户删除订单
			function deletedOrder(id){
				art.dialog({
					width: 250,
					height: 100,
					fixed: true,
				    padding: 0,
				    title: "提示",
				    content: "是否确认删除订单<font style='color:red'>"+id+"</font>？",
				    lock: true,
				    button: [{
					    name: "确定",
					    callback: function () {
					    	$.ajax({
								 url: "${root}/control/order/orderItemController/userDeletedOrder.do?orderId="+id,
								 data: {
								 	
								 },
								 type: "post",
								 success: function(data){
						        	if(data=="true"){
						        		var url = '${root }/control/order/orderItemController/userOrderCompleteList.do?orderUserId=${userSession.userId}';
						        		artDalog("提示","删除订单 "+id+" 成功",url);
						        	}else{
						        		artDalog("错误信息","订单 "+id+" 不存在，无法删除！",null);
						        	}
						      	}
						   	});
					    },
				        focus: true
				     },
				     {
				        name: "取消"
				     }]
				});
			}
			
			jQuery(document).ready(function($){
				//表单提交前 验证 表单
			      var commentDemo = $("#commentForm").Validform({
					btnSubmit : "#btn_sub",
					tiptype : function(msg,o,cssctl){
						//msg：提示信息;
						//o:{obj:*,type:*,curform:*}, obj指向的是当前验证的表单元素（或表单对象），type指示提示的状态，值为1、2、3、4， 1：正在检测/提交数据，2：通过验证，3：验证失败，4：提示ignore状态, curform为当前form对象;
						//cssctl:内置的提示信息样式控制函数，该函数需传入两个参数：显示提示信息的对象 和 当前提示的状态（既形参o中的type）;
						if(!o.obj.is("form")){//验证表单元素时o.obj为该表单元素，全部验证通过提交表单时o.obj为该表单对象;
							var objtip=o.obj.siblings(".Validform_checktip");
							cssctl(objtip,o.type);
							objtip.text(msg);
						}else{
							var objtip=o.obj.find("#msgDemo");
							cssctl(objtip,o.type);
							objtip.text(msg);
						}
					},
					ajaxPost:true,//ajax异步提交表单
					url:'${root }/control/order/commentController/userAddComment.do',
					beforeCheck:function(curform){
						 
					 },
					 beforeSubmit:function(data){
						 
					 },callback:function(data){
					 	if(data.status == 'y'){
					 		$('.contact-bottom-grids').hide();
					 		artDalog('Prompt','success!','${root}/control/order/orderItemController/userOrderCompleteList.do?orderUserId=${userSession.userId}');
					 	}else{
					 		artDalog('Prompt','error!', null);
					 	}
					 }
				});
				//设置验证成功后的提示信息
				commentDemo.tipmsg.r = 'Through verification!';
			});
		</script>
	</head>
	<body>
		<!-- container -->
		<!-- header -->
		<div class="header">
			<%@ include file="/control/jsp/layout/header.jsp" %>
			<!-- /bottom-header -->
		</div>
		<!-- header -->
		<!--- top-nav -->
			<%@ include file="/control/jsp/layout/userMenu.jsp" %>
		<!--- top-nav -->
		<!-- Product-Details-page -->
		<div class="details-page">
			<div class="content details-page">
				<div class="product-details">
					<div class="container">
						<div class="details-left" style="width: 100%;">
						    <h4 style="color:red;"><img style="padding: 10px;" src="${root}/images/bx.gif" />已完成订单</h4>
							<table class="list_order" border="0" align="center" cellpadding="0" cellspacing="2">
							  <thead>
								<tr style="height:40px;">
								  <th>订单号</th>
								  <th>案例</th>
								  <th>商家名称</th>
								  <th>商家联系方式</th>
								  <th>总金额</th>
								  <th>订单状态</th>
								  <th>操作</th>
								</tr>
							  </thead>
							  <tbody style="text-align: center;">
							    <c:if test="${not empty pageView.records }">
							      	<c:forEach items="${pageView.records }" var="order">
							  	        <tr style="height: 20px;"></tr>
									  	<tr style="height: 80px;">
										  <td><a href="${root }/control/order/orderItemController/displayOrderDetail.do?orderId=${order.orderId }&orderUserId=${order.orderUserId }">${fn:escapeXml(order.orderId) }</a></td>
										  <td>
										  	<c:if test="${not empty order.orderCaseId}">
										  		<img width="80" src="${imageService}${order.orderCasePicPath}" />
										  	</c:if>
										  	<c:if test="${empty order.orderCaseId}">
										  		
										  	</c:if>
										  </td>
										  <td>${fn:escapeXml(order.orderShopName) }</td>								  
										  <td>${fn:escapeXml(order.orderShopPhone) }</td>
										  <td>${fn:escapeXml(order.orderMoney) }</td>
										  <td>
										  	<c:if test="${order.orderMoneyStatus == 5}">已完成</c:if>
										  	<c:if test="${order.orderMoneyStatus == 6}">已评价</c:if>
										  	<c:if test="${order.orderMoneyStatus == 7}">已退款</c:if>
										  </td>
										  <td>
										  	<a class="" href="javascript:deletedOrder('${order.orderId }');" style="cursor:pointer;">删除</a>
									      	<c:if test="${order.orderMoneyStatus == 5}">
										  		<a href="javascript:orderComment('${order.orderId }');" style="cursor:pointer; margin-left:20px;">评价</a>
										  	</c:if>
										  </td>
										</tr>
								    </c:forEach>
							    </c:if>
							</tbody>
							</table>
						</div>
						<div class="clearfix"> </div>
					</div>
					<br>
					<!--page-->
					 <%@ include file="/share/pageTwo.jsp" %>
					<!--end page-->
			    </div>
		    </div>
		</div>
		<!-- /Product-Details-page -->
		<!--评价-->
		<%@ include file="/jslib/raty/setRaty.jsp" %>
		<!--end 评价-->
		<!-- 评价 -->
		<script>
			jQuery(document).ready(function($){
				$('.close').click(function(){
					$('#starLevel').val('');
					$('#setRatyOrderId').val('');
					$('#commentContent').val('');
					$('.contact-bottom-grids').hide();
				});

			});
			function orderComment(id){
				$('#setRatyOrderId').val(id);
				$('.contact-bottom-grids').show();
			}
		</script>
		<!--end 评价-->
		<!-- footer -->
		<%@ include file="/control/jsp/layout/footer.jsp" %>
</body>
</html>

